package com.fancy.imasclient.client;

import cn.hutool.db.PageResult;
import com.fancy.common.dto.PlaylistBasicInfo;
import com.fancy.common.dto.response.Result;
import com.fancy.imasclient.dto.UserCollectionResponseDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient(name = "playlist-service",path = "/api/v1")
public interface PlaylistServiceClient {

    /**
     * 获取播放列表基本信息
     */
    @GetMapping("/internal/playlists/{playlistId}")
    Result<PlaylistBasicInfo> getPlaylistBasicInfo(@PathVariable("playlistId") Long playlistId);

    /**
     * 批量获取播放列表信息
     */
    @PostMapping("/internal/playlists/batch")
    Result<List<PlaylistBasicInfo>> getPlaylistBasicInfoBatch(@RequestBody List<Long> playlistIds);

    /**
     * 获取用户收藏数量
     */
    @GetMapping("/collections/count")
    Result<Integer> getCollectionCount(@RequestParam("userId") Long userId);

    /**
     * 获取用户收藏列表
     */
    @GetMapping("/collections")
    Result<PageResult<UserCollectionResponseDTO>> getUserCollections(
            @RequestParam("userId") Long userId,
            @RequestParam(value = "type", required = false) Integer type,
            @RequestParam(value = "page", defaultValue = "1") int page,
            @RequestParam(value = "size", defaultValue = "20") int size);
}
